package com.hmdp.whd;

import java.util.Stack;

@SuppressWarnings("ALL")
class CQueue {
    Stack<Integer> add;
    Stack<Integer> del;

    public CQueue() {
        add = new Stack<>();
        del = new Stack<>();
    }

    public void appendTail(int value) {
        add.push(value);
    }

    public int deleteHead() {
        // 读栈拷贝到写栈
        if(del.isEmpty() && !add.isEmpty()){
            while(!add.isEmpty()){
                del.push(add.pop());
            }
        }
        if(del.isEmpty()) return -1;
        else return del.pop();
    }
}